package com.boco.blch.analysiser.util;

import java.io.InputStream;
import java.util.Properties;

import com.asiainfo.uap.util.des.EncryptInterface;

/**
 * 系统配置文件信息
 * @author tongjie
 *
 */
public class ConfigUtil {
	
	private static boolean hasBeenInit  = false;
	private static final String PATH = "analysiser/compliance_serialnumber.properties";
	private static Properties pro = new Properties(); 
	
	static{
		init();
	}
	public synchronized static void init() {
		try {
			if(!hasBeenInit){
				readProperties();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		hasBeenInit = true;
	}
	
	private static void readProperties() throws Exception{
        InputStream in = ConfigUtil.class.getClassLoader().getResourceAsStream(PATH);
        pro.load(in); 
        in.close();
    } 
	
	public static Properties getProperties(){
		if(!hasBeenInit){
			init();
		}
		return pro;
	}

	public static String getBasePackageName() {
		return getProperties().getProperty("base_package");
	}
	
	public static void main(String[] args) {
		//System.out.println(EncryptInterface.desEncryptData("late1619"));
		String url = "http://10.108.226.140:9099/getBaseAst";
		String param = "ip=123.207.187.219&username=root&password=" + EncryptInterface.desEncryptData("late1619");
		System.out.println(HttpUtil.sendPost(url, param));
	}

}
